All Questions
2 questions
0votes
1answer
564views
Using for_each instead of iterators to avoid iterator invalidation
I am writing a simple custom (special purpose) container and would like to allow for iteration over each element, however, avoid using iterators due to the problem of iterator invalidation. Instead of ...
7votes
5answers
9kviews
C++ Iterators: Best practice to represent end of range - Last or Beyond-last?
I am writing a library which deals a lot with sub-sequences of ordered containers. So for example I have a container (1,2,3,4,5,6) and a user wants to access (3,4,5). I am providing the subsequence ...